<?php

namespace backend\controllers;

use yii\web\Controller;
use backend\models\TmeMerchandisecinfo;
/**
 * #name=菜单树模块#
 * @author Administrator
 *
 */
class ZtreeController extends Controller {
	public $layout="ace";
	public $enableCsrfValidation = false;
	/**
	 * #operation=默认操作#
	 * @return Ambigous <string, string>
	 */
	public function actionIndex(){
				
	if(\Yii::$app->request->isPost){	
		//var_dump(\Yii::$app->request)	;	
	   $data = new TmeMerchandisecinfo(); 		
	   $result = TmeMerchandisecinfo::find()->All();	
	   //var_dump($result);exit;
		$temp=[];
		foreach($result as $c){
			$temp[]=[
			 
			'id'=>$c['ID'],
			'pId'=>$c['MerchandisePID'],
			'name'=>$c['MerchandiseCName']
			 			 
			];			 
		}		 
		echo json_encode($temp);
		exit;
	}
		return $this->render('index');
	}
	
}

?>